"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bggood_store_utils_1 = require("bggood-store-utils");
var StatePlugin = {
    install: function (Vue, options) {
        options = options || {};
        options.obStateType = options.obStateType || bggood_store_utils_1.ObservablePromiseModel;
        Vue.prototype.ObservableState = function (state) {
            if (state instanceof options.obStateType) {
                var objState = {
                    isOnLine: state.isOnLine,
                    isPending: state.isPending,
                    isRejected: state.isRejected,
                    isResolved: state.isResolved,
                    isServerError: state.isServerError,
                    isTimeout: state.isTimeout,
                    error: state.data && !state.data.success ? state.data.message : ''
                };
                return objState;
            }
        };
    }
};
exports.default = StatePlugin;
